package commons

import (
	"go_auth/ext/settings"
	"math/rand"
	"time"
)

//生产验证函数
func RandNewStr(length int) string {
	data := make([]byte, length)
	rand.Seed(time.Now().UnixNano())
	codes := settings.JwtBase.JwtSecret
	for i := 0; i < length; i++ {
		idx := rand.Intn(len(codes))
		data[i] = byte(codes[idx])
	}

	return string(data)
}
